import request from '@/utils/request'

// 获取风采管列表
export function teamdept() {
    return request({
        method: 'get',
        url: '/user/dept'
    })
}
// 待办事项
export function matter({
    page,
    page_size,
}: {
    page: string,
    page_size: string
}) {
    return request({
        method: 'get',
        url: `/matter/lists?&page=${page}&page_size=${page_size}`
    })
}

// 获取党员列表
export function deptList({
    dept_id,
    page,
    page_size,
}: {
    dept_id: any,
    page: string,
    page_size: string
}
) {
    return request({
        method: 'get',
        url: `/user/member_list?dept_id=${dept_id}&page=${page}&page_size=${page_size}`
    })
}
// 党员风采评论留言
export function comment({
    self,
    page,
    page_size,
    member_id,
}: {
    self: number,
    page: string,
    page_size: string
    member_id: string
}
) {
    return request({
        method: 'get',
        url: `/index/comment?&self=${self}&page=${page}&page_size=${page_size}&member_id=${member_id}`
    })
}
//表格搜索
export function mattersou({
    start_time,
    end_time,
    keyword,
    type,
    status,
    page,
    page_size
}: {
    start_time: any
    end_time: any
    keyword: any
    type: any
    status: any
    page: any
    page_size: any
}
) {
    return request({
        method: 'get',
        url: `/matter/lists?start_time=${start_time}&end_time=${end_time}&keyword=${keyword}&type=${type}&status=${status}&page=${page}&page_size=${page_size}`
    })
}
//党员信息
export function deptInfo({
    member_id
}: {
    member_id: number
}
) {
    return request({
        method: 'get',
        url: `/user/member_info?member_id=${member_id}`
    })
}
//党员积分
export function Info() {
    return request({
        method: 'get',
        url: `/user/member_point`
    })
}
//党员信息
export function member_info() {
    return request({
        method: 'get',
        url: `/user/member_info`
    })
}

//党员积分
export function deptPoint({
    member_id
}: {
    member_id: number
}
) {
    return request({
        method: 'get',
        url: `/user/member_point?member_id=${member_id}`
    })
}
//待办事项详情
export function matterdetail({
    todo_id
}: {
    todo_id: number
}
) {
    return request({
        method: 'get',
        url: `/matter/detail?todo_id=${todo_id}`
    })
}

//留言板
export function message({
    page,
    page_size,
    self,
    keyword,
}: {
    page: number,
    page_size: number,
    self: number,
    keyword: any
}
) {
    return request({
        method: 'get',
        url: `/index/message?page=${page}&page_size=${page_size}&self=${self}&keyword=${keyword}`
    })
}
//个人留言
export function messagess({
    page,
    page_size,
    self
}: {
    page: number,
    page_size: number,
    self: number
}
) {
    return request({
        method: 'get',
        url: `/index/message?page=${page}&page_size=${page_size}&self=${self}`
    })
}
// 公开栏
export function release_cate() {
    return request({
        method: 'get',
        url: '/index/release_cate'
    })
}


//公开栏列表
export function cate({
    page,
    page_size,
    cid
}: {
    page: number,
    page_size: number,
    cid: number
}
) {
    return request({
        method: 'get',
        url: `/index/release?page=${page}&page_size=${page_size}&cid=${cid}`
    })
}


//公开栏详情
export function release_detail({
    id
}: {
    id: number
}
) {
    return request({
        method: 'get',
        url: `/index/release_detail?id=${id}`
    })
}
//动态详情
export function listsdetail({
    id
}: {
    id: number
}
) {
    return request({
        method: 'get',
        url: `/style/detail?id=${id}`
    })
}

// 警世钟分类
export function bell_cate() {
    return request({
        method: 'get',
        url: '/index/bell_cate'
    })
}
// 党员职务
export function positionoff() {
    return request({
        method: 'get',
        url: '/user/position'
    })
}
// 党员发展流程
export function process() {
    return request({
        method: 'get',
        url: '/index/process'
    })
}
//警世钟列表
export function bell({
    page,
    page_size,
    cid,
    status
}: {
    page: number,
    page_size: number,
    cid: number,
    status: number,
}
) {
    return request({
        method: 'get',
        url: `/index/bell?page=${page}&page_size=${page_size}&cid=${cid}&status=${status}`
    })
}
//公开栏列表
export function lists({
    page,
    page_size,
    range,
    dept_id,
    member_id
}: {
    page: number,
    page_size: number,
    range: number,
    dept_id: number,
    member_id: number,
}
) {
    return request({
        method: 'get',
        url: `/style/lists?page=${page}&page_size=${page_size}&range=${range}&dept_id=${dept_id}&member_id=${member_id}`
    })
}
//警世钟已读状态
export function bell_read(data: any) {
    return request({
        method: 'post',
        url: '/index/bell_read',
        data
    })
}
//发布留言
export function message_add(data: any) {
    return request({
        method: 'post',
        url: '/index/message_add',
        data
    })
}
//修改
export function member_edit(data: any) {
    return request({
        method: 'post',
        url: '/user/member_edit',
        data
    })
}
//点赞
export function likes(data: any) {
    return request({
        method: 'post',
        url: '/style/like',
        data
    })
}
//练习答题
export function practice_exam(data: any) {
    return request({
        method: 'post',
        url: '/index/practice_exam',
        data
    })
}

//答题排行榜
export function answer({
    page,
    page_size,
}: {
    page: number,
    page_size: number,
}
) {
    return request({
        method: 'get',
        url: `/index/answer?page=${page}&page_size=${page_size}`
    })
}

//首页轮播图
export function rotation({
    type,
}: {
    type: number,
}) {
    return request({
        method: 'get',
        url: `/index/rotation?type=${type}`
    })
}
// 答题练习
export function practice() {
    return request({
        method: 'get',
        url: '/index/practice'
    })
}
// 获取头像名字
export function member_point() {
    return request({
        method: 'get',
        url: '/user/member_point'
    })
}
// 测评
export function assess() {
    return request({
        method: 'get',
        url: '/index/assess'
    })
}

// 开始测评
export function assess_exam(data: any) {
    return request({
        method: 'post',
        url: '/index/assess_exam',
        data
    })
}
// 测评结果
export function assess_submit(data: any) {
    return request({
        method: 'post',
        url: '/index/assess_submit',
        data
    })
}
// 练习结果
export function practice_submit(data: any) {
    return request({
        method: 'post',
        url: '/index/practice_submit',
        data
    })
}


// 上传
enum API {
    //上传图片接口
    UPLOAD_URL = '/upload/image'
}
export const reqUpload = (file: any) => {
    // 创建了一个新的 FormData 对象，用于构建表单数据,并将file添加到FormData对象中
    const formData = new FormData();
    formData.append('file', file);

    return request.post(API.UPLOAD_URL, formData);
}

// 数据大屏
export function dataindex() {
    return request({
        method: 'get',
        url: '/data/index'
    })
}
// 测评记录
export function assess_record() {
    return request({
        method: 'get',
        url: '/index/assess_record'
    })
}
//登录页
export function website() {
    return request({
        method: 'get',
        url: `/index/website`
    })
}
// 添加推荐到首页
export function recommend_add(data: any) {
    return request({
        method: 'post',
        url: '/index/recommend_add',
        data
    })
}
// 添加推荐到首页
export function recommend_del(data: any) {
    return request({
        method: 'post',
        url: '/index/recommend_del',
        data
    })
}
//推荐首页的状态
export function recommend_status({
    id,
    cover,
}: {
    id: number,
    cover: number,
}
) {
    return request({
        method: 'get',
        url: `/index/recommend_status?id=${id}&cover=${cover}`
    })
}